<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no"/>
    <title>{$title}</title>
    <link rel="stylesheet" href="{RES}/plugin/weisrc_tongcheng/images/style.css?v=20180108"/>
    <link rel="stylesheet" href="{RES}/plugin/weisrc_tcyikatong/images/style.css?v=20180108"/>
    <link rel="stylesheet" href="{RES}/plugin/weisrc_tcyikatong/images/iconfont/iconfont.css?v=20180108"/>
    <script src="{RES}/plugin/weisrc_tcyikatong/images/jquery.min-2.1.3.js" type="text/javascript"></script>
    <script src="{RES}/plugin/weisrc_tongcheng/images/global.js?v=20180108" type="text/javascript"></script>

    <link rel="stylesheet" href="{RES}/plugin/weisrc_tongcheng/images/jquery-popups.css?v=20180108"/>
    <script src="{RES}/plugin/weisrc_tongcheng/images/jquery-popups.js?v=20180108" type="text/javascript"></script>

    <script type="text/javascript">
        var commonjspath = '{RES}/plugin/weisrc_tongcheng/images';
    </script>
    <script src="{RES}/plugin/weisrc_tongcheng/images/common.js?v=20180108" type="text/javascript" type="text/javascript"></script>
    <style>
        .tc-template__color {
            color: #06c1ae !important;
        }

        .tc-template__bg {
            background: #06c1ae !important;
        }

        .tc-template__border {
            border-color: #06c1ae !important;
        }
    </style>
    <style>
        .index-tequan__box .index-type__list .type-item.on {
            color: #06c1ae !important;
        }

        .index-tequan__box .index-type__list .type-item.on:before {
            background: #06c1ae;
        }
    </style>
</head>
<body class="tcyikatong-index">
{if $card}
<section class="index-card__cont">
    <section class="index-cont__ka">
        <div class="card-cont__bg"><img src="{RES}/plugin/weisrc_tcyikatong/images/card2.png"></div>
    </section>
    <section class="card-xq__user">
        <div class="user_picurl"><img
                src="{$user['headimgurl']}"/>
        </div>
        <div class="user_info">
            <div class="user_name">NO.{$card['carnumber']} {$user['nickname']}</div>
            <div class="user_viptype">会员卡</div>
            <div class="user_xufei"><a href="{php echo $this->createMobileurl('storecard', array('op' => 'open', 'storeid' => $storeid), true)}">续卡</a></div>
            <div class="user_xufei" style="padding-left: 0px;"><a href="{php echo $this->createMobileurl('storecard', array('op' => 'recharge', 'storeid' => $storeid), true)}">充值</a></div>
        </div>
    </section>
    <section class="card-xq__box dislay-flex">
        <div class="xq-box__lt flex">余额：{$card['coin']}</div>
        <div class="xq-box__rt">有效期至：{php echo date('Y/m/d', $card['lasttime'])}</div>
    </section>
</section>
{else}
<section class="index-card__cont">
    <section class="index-cont__ka">
        <div class="card-cont__bg"><img src="{RES}/plugin/weisrc_tcyikatong/images/card2.png"></div>
    </section>
    <section class="index-cont__layer dislay-flex">
        <section class="cont-layer__box">
            <div class="cont-layer__title">您还未开通会员卡，无法享受特权</div>
            <div class="cont-layer__btn"><a
                    href="{php echo $this->createMobileurl('storecard', array('op' => 'open', 'storeid' => $storeid), true)}">立即开通
            </a></div>
        </section>
    </section>
</section>
{/if}
{if $op == 'open'}
<section class="card-pay__box tcui-cells_checkbox">
    <div class="card-pay__type dislay-flex" style="display: none;">
        <a href="javascript:void(0);" class="pay-type on flex">直接购买</a>
        <a href="javascript:void(0);" class="pay-type flex">使用激活码</a>
    </div>
    <form id="cardForm" onsubmit="return false;">
        <div class="card-type__form card-form">
            {php $first = 1;}
            {loop $pricelist $row}
            <label class="tcui-cell tcui-check__label" for="card-type__{$row['id']}">
                <div class="tcui-cell__hd">
                    <input type="radio" class="tcui-check" name="card-type" value="{$row['id']}" id="card-type__{$row['id']}"
                           {if $first==1}checked="checked"{/if}>
                    <i class="tcui-icon-checked"></i>
                </div>
                <div class="tcui-cell__bd">
                    <p>{$row['title']}<span class="price pt-price">{$row['price']}</span><span
                            class="price zhekou-price">{$row['price']}</span>元/张
                        <!--<span class="shengyunum">(每人限购<span class="price">1</span>张)</span>-->
                    </p>
                    <p>购买起{$row['daycount']}天内有效</p>
                </div>
            </label>
            {php $first++;}
            {/loop}
            <div class="invite-code" style="display:none;">
                <div class="invite-code__box">
                    <div class="invite-code__hd">
                        <input type="text" id="invite_code" name="invite_code" value="" placeholder="请填写邀请码，没有可不填">
                    </div>
                    <div class="invite-code__bd" id="invite_code_msg"></div>
                </div>
            </div>
        </div>
        <div class="card-code__form box_hide card-form">
            <input type="text" name="card_code" value="" placeholder="请输入有效激活码">
        </div>
        <input type="hidden" name="user_id" value="18092">
        <input type="hidden" name="card_type_id" id="type" value="">
        <input type="hidden" name="formhash" value="a2864105">
    </form>
    <label for="xieyi" class="tcui-agree">
        <input id="xieyi" type="checkbox" class="tcui-check">
        <i class="tcui-icon-checked"></i>
        <span class="tcui-agree__text">
            阅读并同意<a href="javascript:void(0);" class="open-popups" data-target="#card-xieyi__box">《相关条款》</a>
        </span>
    </label>

    <div class="card-pay__btn"><a href="javascript:void(0);" class="id_submit_btn tc-template__bg">立即开通</a></div>
</section>
{elseif $op == 'recharge'}
<section class="card-pay__box tcui-cells_checkbox">
    <form id="cardpriceForm" onsubmit="return false;">
        <div class="card-type__form card-form">
            <div class="invite-code" >
                <div class="invite-code__box">
                    <div class="invite-code__hd">
                        <input type="text" id="price" name="price" value="" placeholder="请填写充值金额">
                    </div>
                    <div class="invite-code__bd" id="price_msg"></div>
                </div>
            </div>
        </div>
    </form>
    <div class="card-pay__btn"><a href="javascript:void(0);" class="id_submit_btn2 tc-template__bg">立即充值</a></div>
</section>
{/if}

<section class="index_box" style="margin-top:0px;display: none">
    <div class="box_title"><span>会员特权</span></div>
    <div class="tequan_item">
        <a class="flex" href="plugin.php?id=tom_tcmall&amp;site=1&amp;mod=list&amp;is_vip=1">
            <img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcmall_icon.png">

            <p>商城会员价</p>
        </a>
        <a class="flex" href="youku.php?id=tlqg&amp;site=1&amp;mod=index">
            <img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcqianggou_icon2.png">

            <p>抢购会员价</p>
        </a>
        <a class="flex" href="youku.php?id=tltc&amp;site=1&amp;mod=fabu">
            <img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-fenlei_icon2.png">

            <p>半价发布信息</p>
        </a>
        <a class="flex">
            <img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcshop_icon2.png">

            <p>特约商户折扣</p>
        </a>
    </div>
    <div class="new-card__list">
        <ul>
            <li>陈鹏开通了月卡</li>
            <li>迷失卍国度开通了体验卡</li>
            <li>黄扬开通了体验卡</li>
            <li>OMG开通了月卡</li>
            <li>开通了半年卡</li>
            <li>何阳光开通了月卡</li>
            <li>丨十丨开通了月卡</li>
            <li>亚飞开通了体验卡</li>
            <li>Niel开通了体验卡</li>
            <li>嗯哼开通了体验卡</li>
        </ul>
    </div>
</section>
<section class="card-tequan__box">
    <div class="card-tequan__title"><span>会员特权</span></div>
    <div class="card-tequan__list">
        {loop $privilegelist $row}
        {if $row['icon'] == 1}
        {php $icon = 'tequan-tcshop_icon2.png';}
        {elseif $row['icon'] == 2}
        {php $icon = 'tequan-tcmall_icon.png';}
        {elseif $row['icon'] == 3}
        {php $icon = 'tequan-tcqianggou_icon2.png';}
        {elseif $row['icon'] == 4}
        {php $icon = 'tequan-fenlei_icon2.png';}
        {/if}
        {if empty($row['url'])}
        {php $url = '#'}
        {else}
        {php $url = $row['url'];}
        {/if}
        <div class="tequan-list__item dislay-flex">
            <div class="tequan-item__hd tequan-item__glod">
                <img src="{RES}/plugin/weisrc_tcyikatong/images/{$icon}">
            </div>
            <div class="tequan-item__bd">
                <h5>{$row['title']}</h5>
                <p>{$row['desc']}</p>
                <a href="{php echo $url}" style="display:none;"></a>
                <i style="display:none;">去领取</i>
            </div>
        </div>
        {/loop}

        <!--<div class="tequan-list__item dislay-flex">-->
            <!--<div class="tequan-item__hd tequan-item__glod">-->
                <!--<img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcshop_icon2.png">-->
            <!--</div>-->
            <!--<div class="tequan-item__bd">-->
                <!--<h5>特约商户折扣</h5>-->

                <!--<p>会员可以在商家指定特权日享受专属优惠</p>-->
                <!--<a link="indexa.php?id=tlka&amp;site=1&amp;mod=index" style="display:none;"></a>-->
                <!--<i style="display:none;">去领取</i>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="tequan-list__item dislay-flex">-->
            <!--<div class="tequan-item__hd tequan-item__glod">-->
                <!--<img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcmall_icon.png">-->
            <!--</div>-->
            <!--<div class="tequan-item__bd">-->
                <!--<h5>商城会员价</h5>-->

                <!--<p>可以享受商城商品VIP特价购买</p>-->
                <!--<a link="plugin.php?id=tom_tcmall&amp;site=1&amp;mod=list&amp;is_vip=1" style="display:none;"></a>-->
                <!--<i style="display:none;">去看看</i>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="tequan-list__item dislay-flex">-->
            <!--<div class="tequan-item__hd tequan-item__glod">-->
                <!--<img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-tcqianggou_icon2.png">-->
            <!--</div>-->
            <!--<div class="tequan-item__bd">-->
                <!--<h5>抢购会员价</h5>-->

                <!--<p>可以享受抢购商品VIP特价购买</p>-->
                <!--<a link="youku.php?id=tlqg&amp;site=1&amp;mod=index" style="display:none;"></a>-->
                <!--<i style="display:none;">去抢购</i>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="tequan-list__item dislay-flex">-->
            <!--<div class="tequan-item__hd tequan-item__glod">-->
                <!--<img src="{RES}/plugin/weisrc_tcyikatong/images/tequan-fenlei_icon2.png">-->
            <!--</div>-->
            <!--<div class="tequan-item__bd">-->
                <!--<h5>半价发布信息</h5>-->

                <!--<p>会员可以半价发布，免费刷新分类信息</p>-->
                <!--<a link="youku.php?id=tltc&amp;site=1&amp;mod=fabu" style="display:none;"></a>-->
                <!--<i style="display:none;">去发布</i>-->
            <!--</div>-->
        <!--</div>-->
    </div>
</section>
<div id="card-xieyi__box" class='pop-ups__container'>
    <div class="pop-ups__overlay"></div>
    <div class="pop-ups__modal">
        <div class="pop-ups__box">
            <div class="list_sfc_top tc-template__bg">会员卡条款</div>
            <section class="list_sfc_txt">
                {php echo htmlspecialchars_decode($item['card_rule']);}
            </section>
            <div class="pop-ups__block"></div>
        </div>
        <div class="pop-ups__close">
            <a href="javascript:void(0);" class="tcui-btn tcui-btn_default close-popups">关闭</a>
        </div>
    </div>
</div>
<form action="{php echo url('mc/cash/wechat');}" method="post" id="payform">
    <input type="hidden" name="params" id="params" value="" />
    <input type="hidden" name="code" value="" />
    <input type="hidden" name="coupon_id" value="" />
</form>

<section class="index_box" style="display: none;">
    <div class="box_title">
        <span>专属限时购</span>
        <a href="youku.php?id=tlqg&amp;site=1&amp;mod=index&amp;vip=1">
            <div class="more">更多</div>
        </a>
    </div>
    <div class="qianggou_area">
        <div class="qianggou_bd clearfix">
            <a href="youku.php?id=tlqg&mod=details&goods_id=10">
                <div class="bd-img">
                    <img src="https://shop.com/data/attachment/shop/201807/09/111957kb7f7wneglf9zchh.png">
                </div>
            </a>

            <div class="bd-content">
                <h5><a href="youku.php?id=tlqg&mod=details&goods_id=10"> Iphone X 1元抢购测试</a></h5>

                <p class="price">
                    <span class="now_price">{$setting['currency']}<span>0.50</span></span>&nbsp;<span
                        class="ykt_price"><span>会员卡</span></span>
                </p>

                <p class="price">
                    <span class="old_price">非会员价：{$setting['currency']}1.00</span>
                </p>

                <p class="time">
                    距结束：<span class="time_hours daojishi" data-time="15007637000">-</span>
                </p>

                <div class="button">
                    <a href="youku.php?id=tlqg&mod=details&goods_id=10">马上抢购</a>
                </div>
            </div>
        </div>
    </div>
    <div class="qianggou_area">
        <div class="qianggou_bd clearfix">
            <a href="youku.php?id=tlqg&mod=details&goods_id=1">
                <div class="bd-img">
                    <img src="https://shop.com/data/attachment/shop/201807/09/102445ucmp8mcjsf1cjpsf.png">
                </div>
            </a>

            <div class="bd-content">
                <h5><a href="youku.php?id=tlqg&mod=details&goods_id=1">海底捞套餐抢购</a></h5>

                <p class="price">
                    <span class="now_price">{$setting['currency']}<span>0.10</span></span>&nbsp;<span
                        class="ykt_price"><span>会员卡</span></span>
                </p>

                <p class="price">
                    <span class="old_price">非会员价：{$setting['currency']}0.20</span>
                </p>

                <p class="time">
                    距结束：<span class="time_hours daojishi" data-time="14951837000">-</span>
                </p>

                <div class="button">
                    <a href="youku.php?id=tlqg&mod=details&goods_id=1">马上抢购</a>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="index_box" style="display: none;">
    <div class="box_title">
        <span>专属商城优惠</span>
        <a href="plugin.php?id=tom_tcmall&amp;site=1&amp;mod=list&amp;is_vip=1">
            <div class="more">更多</div>
        </a>
    </div>
    <div class="mall-list dislay-flex">
        <a class="mall-list__item " href="plugin.php?id=tom_tcmall&mod=goodsinfo&goods_id=2">
            <div class="item-pic">
                <img src="https://shop.com/data/attachment/shop/201807/12/234702sgsr9idgs359z1be.jpg">
            </div>
            <div class="item-content">
                <div class="item-content__title">七匹狼短袖T恤男2018年夏装新款男装多彩POLO衫男士纯棉翻领半袖t恤衫2057</div>
                <div class="item-content__vipprice"><span class="ico">{$setting['currency']}</span>0.02<span class="vip_name">会员卡</span><span
                        class="shoujian">{$setting['currency']}0.04</span></div>
            </div>
        </a>
        <a class="mall-list__item " href="plugin.php?id=tom_tcmall&mod=goodsinfo&goods_id=1">
            <div class="item-pic">
                <img src="https://shop.com/data/attachment/shop/201807/12/232518zhw0jshuwg7tszwz.jpg">
            </div>
            <div class="item-content">
                <div class="item-content__title">小米6X 全网通 4GB+32GB 流沙金 移动联通电信4G手机 双卡双待 智能手机</div>
                <div class="item-content__vipprice"><span class="ico">{$setting['currency']}</span>0.01<span class="vip_name">会员卡</span><span
                        class="shoujian">{$setting['currency']}0.02</span></div>
            </div>
        </a>
    </div>
</section>
<section class="index_box" style="border-bottom: 1px solid #efefef;display: none;">
    <div class="box_title"><span>开卡礼包</span></div>
</section>
<section class="index-tequan__box card-list" id="card-box" style="display: none;">
    <div class="index-card__list" id="card-list"></div>
    <section style="display: none;" id="card-load-html"></section>
</section>
<section class="index_box" style="display: none;">
    <div class="box_title"><span>折扣专属区</span></div>
</section>
<section class="index-tequan__box" style="margin-top:0px;display: none;">
    <div class="index-type__list dislay-flex">
        <a class="type-item on flex" data-id="tequan-box" href="javascript:void(0);">今日特权</a>
        <a class="type-item flex" href="indexa.php?id=tlka&amp;site=1&amp;mod=list">全部特权</a>
    </div>
</section>
<section class="index-tequan__box tequan-list" id="tequan-box" style="display: none;">
    <div class="index-days__list dislay-flex">
        <a class="days-item" data-week="0" data-day="0" href="javascript:void(0);">
            <h5>6月</h5>

            <div class="days">全部</div>
        </a>
        <a class="days-item" data-week="1" data-day="10" href="javascript:void(0);">
            <h5>周一</h5>

            <div class="days on">今天</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="2" data-day="11" href="javascript:void(0);">
            <h5>周二</h5>

            <div class="days">11</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="3" data-day="12" href="javascript:void(0);">
            <h5>周三</h5>

            <div class="days">12</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="4" data-day="13" href="javascript:void(0);">
            <h5>周四</h5>

            <div class="days">13</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="5" data-day="14" href="javascript:void(0);">
            <h5>周五</h5>

            <div class="days">14</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="6" data-day="15" href="javascript:void(0);">
            <h5>周六</h5>

            <div class="days">15</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="7" data-day="16" href="javascript:void(0);">
            <h5>周日</h5>

            <div class="days">16</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="1" data-day="17" href="javascript:void(0);">
            <h5>周一</h5>

            <div class="days">17</div>
            <span>3</span>
        </a>
        <a class="days-item" data-week="2" data-day="18" href="javascript:void(0);">
            <h5>周二</h5>

            <div class="days">18</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="3" data-day="19" href="javascript:void(0);">
            <h5>周三</h5>

            <div class="days">19</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="4" data-day="20" href="javascript:void(0);">
            <h5>周四</h5>

            <div class="days">20</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="5" data-day="21" href="javascript:void(0);">
            <h5>周五</h5>

            <div class="days">21</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="6" data-day="22" href="javascript:void(0);">
            <h5>周六</h5>

            <div class="days">22</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="7" data-day="23" href="javascript:void(0);">
            <h5>周日</h5>

            <div class="days">23</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="1" data-day="24" href="javascript:void(0);">
            <h5>周一</h5>

            <div class="days">24</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="2" data-day="25" href="javascript:void(0);">
            <h5>周二</h5>

            <div class="days">25</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="3" data-day="26" href="javascript:void(0);">
            <h5>周三</h5>

            <div class="days">26</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="4" data-day="27" href="javascript:void(0);">
            <h5>周四</h5>

            <div class="days">27</div>
            <span>3</span>
        </a>
        <a class="days-item" data-week="5" data-day="28" href="javascript:void(0);">
            <h5>周五</h5>

            <div class="days">28</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="6" data-day="29" href="javascript:void(0);">
            <h5>周六</h5>

            <div class="days">29</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="7" data-day="30" href="javascript:void(0);">
            <h5>周日</h5>

            <div class="days">30</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="1" data-day="1" href="javascript:void(0);">
            <h5>周一</h5>

            <div class="days">1</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="2" data-day="2" href="javascript:void(0);">
            <h5>周二</h5>

            <div class="days">2</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="3" data-day="3" href="javascript:void(0);">
            <h5>周三</h5>

            <div class="days">3</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="4" data-day="4" href="javascript:void(0);">
            <h5>周四</h5>

            <div class="days">4</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="5" data-day="5" href="javascript:void(0);">
            <h5>周五</h5>

            <div class="days">5</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="6" data-day="6" href="javascript:void(0);">
            <h5>周六</h5>

            <div class="days">6</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="7" data-day="7" href="javascript:void(0);">
            <h5>周日</h5>

            <div class="days">7</div>
            <span>3</span>
        </a>
        <a class="days-item" data-week="1" data-day="8" href="javascript:void(0);">
            <h5>周一</h5>

            <div class="days">8</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="2" data-day="9" href="javascript:void(0);">
            <h5>周二</h5>

            <div class="days">9</div>
            <span>2</span>
        </a>
        <a class="days-item" data-week="3" data-day="10" href="javascript:void(0);">
            <h5>周三</h5>

            <div class="days">10</div>
            <span>2</span>
        </a>
    </div>
    <div class="index-tequan__list" id="index-list"></div>
    <section style="display: none;" id="load-html"></section>
</section>
<section class="tc114-index__foot" style="display: none;">
    <div class="tc114-index__footer">
        <div class="info-footer-item">
            <a href="youku.php?id=tltc&amp;site=1&amp;mod=index">
                <i class="tciconfont tcicon-nav__index"></i>
                <span>首页</span>
            </a>
        </div>
        <div class="info-footer-item on">
            <a class=" tc-template__color" href="indexa.php?id=tlka&amp;site=1&amp;mod=index">
                <i class="tciconfont tcicon-yikatong"></i>
                <span>会员卡</span>
            </a>
        </div>
        <div class="info-footer-item">
            <a href="indexa.php?id=tlka&amp;site=1&amp;mod=ruzhu">
                <i class="tciconfont tcicon-ykt__ruzhu"></i>
                <span>加入</span>
            </a>
        </div>
        <div class="info-footer-item">
            <a href="indexa.php?id=tlka&amp;site=1&amp;mod=mylinglist">
                <i class="tciconfont tcicon-ykt__jilv "></i>
                <span>使用</span>
            </a>
        </div>
        <div class="info-footer-item">
            <a href="youku.php?id=tltc&amp;site=1&amp;mod=personal">
                <i class="tciconfont tcicon-nav__my"></i>
                <span>我的</span>
            </a>
        </div>
    </div>
</section>
<section class="back_top">
    <a href="javascript:void(0);"><img src="{RES}/plugin/weisrc_tongcheng/images/back_top.png"></a>
</section>
<!--<script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript" type="text/javascript"></script>-->
<script>
    var loadWeek = "1";
    var loadDay = "10";
    var loadPage = 1;
    var loadCardPage = 1;
    $('.index-type__list').on('click', '.type-item', function () {
        var id = $(this).data('id');

        if ($(this).hasClass('on')) {
            return false;
        }
        $(this).addClass('on').siblings('.type-item').removeClass('on');
        if (id == 'tequan-box') {
            $('#card-box').hide();
            $('#tequan-box').show();
            if (loadPage == 1) {
                loadList();
            }
        }
    })

    $(document).on('click', '.days-item', function () {
        var week = $(this).data('week');
        var day = $(this).data('day');
        if (week == loadWeek) {
            return false;
        }
        loadPage = 1;

        loadWeek = week;
        loadDay = day;
        $(this).siblings('.days-item').find('.days').removeClass('on');
        $(this).find('.days').addClass('on');

        loadList();
    })

    var loadHtml = '<div class="tcui-loadmore" style="padding:1em"><i class="tcui-loading"></i><span class="tcui-loadmore__tips">正在加载...</span></div>';
    var noMoreHtml = '<div class="tcui-loadmore" style="padding:1em"><span class="tcui-loadmore__tips">没有更多信息...</span></div>';
    var loadListStatus = 0;
    function loadList() {
        if (loadListStatus == 1) {
            return false;
        }
        if (loadPage == 1) {
            $("#index-list").html('');
        }
        loadListStatus = 1;
        $("#load-html").html(loadHtml).show();
//    $.ajax({
//        type: "GET",
//        url: 'indexa.php?id=tlka:ajax&act=list&formhash=a2864105',
//        data: {page:loadPage,week:loadWeek,day:loadDay},
//        success: function(msg){
//
//            loadListStatus = 0;
//            var data = eval('('+msg+')');
//            if(data == 205){
//                $("#load-html").html(noMoreHtml);
//                return false;
//            }else{
//                loadPage += 1;
//                $('#load-html').hide();
//                $("#index-list").append(data);
//            }
//        }
//    });
    }

    var loadCardListStatus = 0;
    function loadCardList() {
        if (loadCardListStatus == 1) {
            return false;
        }
        if (loadCardPage == 1) {
            $("#card-list").html('');
        }
        loadCardListStatus = 1;
        $("#card-load-html").html(loadHtml).show();
        $.ajax({
            type: "GET",
            url: 'indexa.php?id=tlka:ajax&act=gift_list&formhash=a2864105',
            data: {page: loadCardPage},
            success: function (msg) {

                loadCardListStatus = 0;
                var data = eval('(' + msg + ')');
                if (data == 205) {
                    $("#card-load-html").html(noMoreHtml);
                    return false;
                } else {
                    loadCardPage += 1;
                    $('#card-load-html').hide();
                    $("#card-list").append(data);
                    countDaojishi();
                }
            }
        });
    }

    $(function () {
        loadList();
        loadCardList();
    })

    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if ((scrollTop + windowHeight) >= (scrollHeight * 0.9)) {
            loadList();
        }
        if ((scrollTop + windowHeight) >= 1000) {
            $('.back_top').show();
        } else {
            $('.back_top').hide();
        }

    });

    var djsTime;
    function countDaojishi() {
        window.clearInterval(djsTime);
        djsTime = setInterval(function () {
            $(".daojishi").each(function () {
                var t = $(this).attr('data-time');
                t = t - 100;
                var d = Math.floor(t / 1000 / 60 / 60 / 24);
                var h = Math.floor(t / 1000 / 60 / 60 % 24);
                var m = Math.floor(t / 1000 / 60 % 60);
                var s = Math.floor(t / 1000 % 60);
                if (t > 0) {
                    var str = d + "天" + ( h < 10 ? "0" + h : h) + "时" + ( m < 10 ? "0" + m : m) + "分" + ( s < 10 ? "0" + s : s) + "秒";
                }
                else {
                    var str = "已结束";
                }
                $(this).attr('data-time', t);
                $(this).html(str);
            })
        }, 100);
    }

    $(document).on('click', '.back_top', function () {
        $('body,html').animate({scrollTop: 0}, 500);
        return false;
    });

    $(document).ready(function () {
        $.get("indexa.php?id=tlka:ajax&act=update_user_card&formhash=a2864105");
    })
    var scrollRunStatus = 0;
    $(window).scroll(function () {
        var runScrollTop = $(this).scrollTop();
        if (runScrollTop > 100 && scrollRunStatus == 0) {
            scrollRunStatus = 1;
            console.log('runScrollTop:' + runScrollTop);
            $.get("indexa.php?id=tlka:ajax&act=update_gift&formhash=a2864105");
            $.get("indexa.php?id=tlka:ajax&act=add_lbs&formhash=a2864105");
        }
    });

    var djsTime;
    function countDaojishi() {
        window.clearInterval(djsTime);
        djsTime = setInterval(function () {
            $(".daojishi").each(function () {
                var t = $(this).attr('data-time');
                t = t - 100;
                var d = Math.floor(t / 1000 / 60 / 60 / 24);
                var h = Math.floor(t / 1000 / 60 / 60 % 24);
                var m = Math.floor(t / 1000 / 60 % 60);
                var s = Math.floor(t / 1000 % 60);
                if (t > 0) {
                    var str = "<span>" + d + "</span>天<span>" + ( h < 10 ? "0" + h : h) + "</span>时<span>" + ( m < 10 ? "0" + m : m) + "</span>分<span>" + ( s < 10 ? "0" + s : s) + "</span>秒";
                }
                else {
                    var str = "已结束";
                }
                $(this).attr('data-time', t);
                $(this).html(str);
            })
        }, 100);
    }

    $(document).ready(function () {
        countDaojishi();
    });

    $(function () {
        setInterval(function () {
                    var e = $(".new-card__list ul");
                    e.scrollTo({
                        to: e.find("li").eq(0).height(),
                        durTime: 800,
                        delay: 80,
                        callback: function () {
                            var a = e.find("li").eq(0),
                                    i = a.clone(!0);
                            e.scrollTop(0),
                                    a.remove(),
                                    e.append(i)
                        }
                    })
                },
                2e3)
    });




    $(document).ready(function () {
        $("#xieyi").prop("checked", true);
    });

    $(document).on('click', '.tcui-dialog__btn_primary', function () {
        tusi("必须阅读并同意《相关条款》");
        $(this).parents('.js_dialog').fadeOut(200);
    })

    $(document).on('click', '.tequan-list__item', function () {
        var title = $(this).find('.tequan-item__bd h5').html();
        var text = $(this).find('.tequan-item__bd p').html();
        var link = $(this).find('.tequan-item__bd a').attr('link');
        var btn = $(this).find('.tequan-item__bd i').html();

        $('.card-tequan__layer .rule-layer__box .rule-title').html(title);
        $('.card-tequan__layer .rule-layer__box .rule-shop').html(text);
        $('.card-tequan__layer .rule-layer__box .rule-btn .rule-btn__queren').attr('href', link);
        ;
        $('.card-tequan__layer .rule-layer__box .rule-btn .rule-btn__queren').html(btn);
        $('.card-tequan__layer').removeClass('box_hide');
    });

    $(document).on('click', '.rule-btn__cancel', function () {
        $('.card-tequan__layer').addClass('box_hide');
        $('.card-tequan__layer .rule-layer__box .rule-title').html('');
        $('.card-tequan__layer .rule-layer__box .rule-shop').html('');
    });

    var payType = 1;
    $(document).on('click', '.card-pay__type a', function () {
        var index = $(this).index();
        $(this).addClass('on').siblings('a').removeClass('on');
        if (index == 1) {
            payType = 2;
        } else {
            payType = 1;
        }

        if ($('.card-form').eq(index).hasClass('box_hide')) {
            $('.card-form').eq(index).removeClass('box_hide').siblings('.card-form').addClass('box_hide');
        }

    })

    var submintBtnStatus = 0;
    $(document).on('click', '.id_submit_btn', function () {
        if (payType == 1) {
            $('#type').val($('input[name="card-type"]:checked').val());
            pay();
        } else if (payType == 2) {
            code();
        } else if (payType == 3) {
            recharge();
        }
    })

    $(document).on('click', '.id_submit_btn2', function () {
        recharge();
    })

    function recharge() {
        if (submintBtnStatus == 1) {
            return false;
        }

        var price = $.trim($('input[name="price"]').val());
        if (price == '') {
            tusi("请输入充值金额");
            return false;
        }

        submintBtnStatus = 1;
        $.ajax({
            type: "POST",
            url: "{php echo $this->createMobileUrl('addtoorder', array('storeid' => $storeid, 'from_user' => $from_user), true)}",
            dataType: "json",
            data:{
                "type": "add",
                "ordertype":8, //充值
                "total":price
            },
            success: function (data) {
                submintBtnStatus = 0;
                if (data.message['code'] != 0) {
//                    var url = "{php echo $this->createMobileUrl('orderdetail', array(), true)}" +
//                            "&orderid=" + data.message['orderid'];
                    $('#params').val(data.message['params']);
                    $('#payform').submit();
                } else {
                    tusi(data.message['msg']);
                }
            }
        });
    }

    function pay() {
        if (submintBtnStatus == 1) {
            return false;
        }

        card_type = $("input:radio[name='card-type']:checked").val();
//        alert(card_type);
//        return;

        if ($('#xieyi').prop("checked")) {
        } else {
            tusi("必须阅读并同意《相关条款》");
            return false;
        }

        submintBtnStatus = 1;
//        $('#cardForm').serialize()


        $.ajax({
            type: "POST",
            url: "{php echo $this->createMobileUrl('addtoorder', array('storeid' => $storeid, 'from_user' => $from_user), true)}",
            dataType: "json",
            data:{
                "type": "add",
                "ordertype":7,
                "card_type":card_type
            },
            success: function (data) {
                submintBtnStatus = 0;
                if (data.message['code'] != 0) {
                    var url = "{php echo $this->createMobileUrl('orderdetail', array(), true)}" +
                            "&orderid=" + data.message['orderid'];
//                    location.href = url;
//                    setTimeout(function () {
//                        window.location.href = url;
//                    }, 1888);

                    $('#params').val(data.message['params']);
                    $('#payform').submit();
                } else {
                    tusi(data.message['msg']);
                }

//                if (data.status == 200) {
//                    tusi("订单创建成功");
//                    setTimeout(function () {
//                        window.location.href = data.payurl;
//                    }, 1888);
//                } else if (data.status == 301) {
//                    tusi("用户被封号");
//                } else if (data.status == 302) {
//                    tusi("没有安装支付中心插件");
//                } else if (data.status == 303) {
//                    tusi("支付流插入数据失败");
//                } else if (data.status == 304) {
//                    tusi("没有剩余购买次数");
//                } else if (data.status == 404) {
//                    tusi("数据插入失败");
//                } else if (data.status == 500) {
//                    tusi("数据异常");
//                } else {
//                    tusi("下单错误");
//                }
            }
        });
    }

    function code() {
        if (submintBtnStatus == 1) {
            return false;
        }

        var card_code = $.trim($('input[name="card_code"]').val());
        if (card_code == '') {
            tusi("必须输入有效激活码");
            return false;
        }

        if ($('#xieyi').prop("checked")) {
        } else {
            tusi("必须阅读并同意《相关条款》");
            return false;
        }


        submintBtnStatus = 1;
        $.ajax({
            type: "POST",
            url: "indexa.php?id=tlka:ajax&act=code&formhash=a2864105",
            dataType: "json",
            data: $('#cardForm').serialize(),
            success: function (data) {
                submintBtnStatus = 0;
                if (data == 200) {
                    tusi("激活成功");
                    setTimeout(function () {
                        window.location.href = window.location.href + "&prand=525";
                    }, 1888);
                } else if (data == 301) {
                    tusi("激活码不存在");
                } else if (data == 302) {
                    tusi("激活码已被使用");
                } else if (data == 303) {
                    tusi("用户不存在或已被封号");
                } else if (data == 404) {
                    tusi("数据插入失败");
                } else {
                    tusi("激活错误");
                }
            }
        });
    }
</script>
<!--<script>-->
    <!--wx.config({-->
        <!--debug: false,-->
        <!--appId: 'wx952a5b0ad4d5f5ca',-->
        <!--timestamp: 1560178483,-->
        <!--nonceStr: '1I6Pzplig88AkDbc',-->
        <!--signature: '7151e7108814ce02c131e5aaffa6b690c3485dab',-->
        <!--jsApiList: [-->
            <!--'onMenuShareTimeline',-->
            <!--'onMenuShareAppMessage',-->
            <!--'previewImage',-->
            <!--'openLocation',-->
            <!--'getLocation'-->
        <!--]-->
    <!--});-->
    <!--wx.ready(function () {-->
        <!--wx.onMenuShareTimeline({-->
            <!--title: '同城超级卡',-->
            <!--link: 'https://shop.com/indexa.php?id=tlka&mod=index',-->
            <!--imgUrl: 'http://discuz.shop.net/tom/qrcode.jpg',-->
            <!--success: function () {-->

            <!--},-->
            <!--cancel: function () {-->
            <!--}-->
        <!--});-->
        <!--wx.onMenuShareAppMessage({-->
            <!--title: '同城超级卡',-->
            <!--desc: '加入会员更优惠',-->
            <!--link: 'https://shop.com/indexa.php?id=tlka&mod=index',-->
            <!--imgUrl: 'http://discuz.shop.net/tom/qrcode.jpg',-->
            <!--type: 'link',-->
            <!--dataUrl: '',-->
            <!--success: function () {-->

            <!--},-->
            <!--cancel: function () {-->
            <!--}-->
        <!--});-->
        <!--wx.onMenuShareQQ({-->
            <!--title: '同城超级卡',-->
            <!--desc: '加入会员更优惠',-->
            <!--link: 'https://shop.com/indexa.php?id=tlka&mod=index',-->
            <!--imgUrl: 'http://discuz.shop.net/tom/qrcode.jpg',-->
            <!--success: function () {-->

            <!--},-->
            <!--cancel: function () {-->
            <!--}-->
        <!--});-->
    <!--});-->
<!--</script>-->
</body>
</html>
<!--<script src="{RES}/plugin/weisrc_tcyikatong/images/index.js"></script>-->
<!--<script src="{RES}/plugin/weisrc_tongcheng/images/miniprogram.js?v=201805031"></script>-->